package cn.fresh.xuanyuan.module.trade.enums.order;

import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;


@Getter
public enum DouYinOrderStatusEnum {
    UNPAID(0, 0,"待支付","待支付"),
    UNDELIVERED(10, 1,"已支付","待发货"),
    CANCELED(40, 2,"已取消","已取消");
    ;

    DouYinOrderStatusEnum(Integer status, Integer douYinStatus, String douYinStatusStr, String remark) {
        this.status = status;
        this.douYinStatusInt = douYinStatus;
        this.douYinStatusStr = douYinStatusStr;
        this.remark = remark;
    }

    private Integer status;

    private Integer douYinStatusInt;

    private String douYinStatusStr;

    private String remark;

    public static Integer getDouYinStatusInt(Integer status) {
        Optional<DouYinOrderStatusEnum> enumOptional = Arrays.stream(values())
                .filter(item -> Objects.equals(item.status, status))
                .findFirst();
        return enumOptional.isPresent() ? enumOptional.get().getDouYinStatusInt() : 0;
    }

    public static String getDouYinStatusStr(Integer status) {
        Optional<DouYinOrderStatusEnum> enumOptional = Arrays.stream(values())
                .filter(item -> Objects.equals(item.status, status))
                .findFirst();
        return enumOptional.isPresent() ? enumOptional.get().getDouYinStatusStr() : "未知状态";
    }
}
